package com.eascs.admin.o2o.loan.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.admin.o2o.loan.dao.LoanapplyOpLogDao;
import com.eascs.admin.o2o.loan.entity.O2oLoanGsInfo;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;

@Service
public class O2oLoanGsService implements IO2oLoanGsScService<O2oLoanGsInfo> {

	@Autowired
	LoanapplyOpLogDao dao;

	public int insertEntity(O2oLoanGsInfo t) {
		return dao.insert(t);
	}

	public int updateEntity(O2oLoanGsInfo t) {
		return dao.updateById(t);
	}

	public O2oLoanGsInfo getEntityById(String id) {
		return dao.getById(O2oLoanGsInfo.class, id);
	}

	public O2oLoanGsInfo getLoanapplyNo(String loanapplyNo) {
		String sql = "select * from o2o_loan_gs_info where loanapply_no = ?";
		return dao.findEntity(sql, O2oLoanGsInfo.class, loanapplyNo);
	}

	public List<O2oLoanGsInfo> queryEntitys(O2oLoanGsInfo t) {
		return null;
	}

	public PageResult<Object[]> queryPage(O2oLoanGsInfo t, int pageSize, int pageIndex) {
		SqlPageQuery<Object[]> pageQuery = new SqlPageQuery<>(Object[].class, pageSize, pageIndex);
		String querySql = "select * from o2o_loan_gs_info where loanapply_no=?";
		pageQuery.addParam(t.getLoanapplyNo());
		pageQuery.setQuerySql(querySql);
		return dao.findDataWithPage(pageQuery);
	}

}
